package com.wyy.stujpa.entity;

import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "java_class")
public class JavaClass {
    @Id
    @Column(name = "c_id")
    private Integer cId;
    @Column(name = "c_name")
    private String cName;
    @Column(name = "c_intro")
    private String cIntro;
    //管理关系相关的属性
    //mappedBy = "javaClass":由多方维护关系，"javaClass"是多方中由关联关系的属性名，设置了多方维护关系，就不需要@JoinColumn
    @OneToMany(fetch = FetchType.EAGER,
            cascade = CascadeType.ALL,
            mappedBy = "javaClass") //里面的内容是可选项，不是必须的
//    @JoinColumn(name = "c_id") //外键相关的列
    private List<Student> stus;


    public Integer getcId() {
        return cId;
    }

    public void setcId(Integer cId) {
        this.cId = cId;
    }

    public String getcName() {
        return cName;
    }

    public void setcName(String cName) {
        this.cName = cName;
    }

    public String getcIntro() {
        return cIntro;
    }

    public void setcIntro(String cIntro) {
        this.cIntro = cIntro;
    }

    public List<Student> getStus() {
        return stus;
    }

    public void setStus(List<Student> stus) {
        this.stus = stus;
    }
}
